/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Practica6.practica;

import Practica6.util.Vertex;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author miguel
 */
public class MyVertex<E> extends Vertex<E> {
    
    private ArrayList<MyVertex> vecinos;
    private int distancia = 0;
    private MyVertex padre = null;
    
    public MyVertex(){
        super();
        vecinos = new ArrayList<>();
    }
    
    public MyVertex(E element){
        super(element);
        vecinos = new ArrayList<>();
    }
    
    public MyVertex(E element, int index){
        super(element);
        vecinos = new ArrayList<>();
    }

    public int getDistancia() {
        return distancia;
    }

    public void setDistancia(int distancia) {
        this.distancia = distancia;
    }

    public MyVertex getPadre() {
        return padre;
    }

    public void setPadre(MyVertex padre) {
        this.padre = padre;
    }
    
    

    @Override
    public List getNeighboursList() {
        return vecinos;
    }

    @Override
    public Vertex getNeighbour(int i) {
        return vecinos.get(i);
    }

    @Override
    public void addNeighbours(List vs) {
        for(MyVertex v: (List<MyVertex>)vs){
            vecinos.add(v);
        }
    }

    @Override
    public void addSymmetricNeighbours(List vs) {
        for(MyVertex v: (List<MyVertex>)vs){
            vecinos.add(v);
            v.addNeighbour(this);
        }
    }

    @Override
    public void addNeighbour(Vertex v) {
        vecinos.add((MyVertex)v);
    }

    @Override
    public void addSymmetricNeighbour(Vertex v) {
        addNeighbour(v);
        v.addNeighbour(this);
    }

    @Override
    public int grade() {
        return vecinos.size();
    }
    
}
